import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    zrUser:{
      zrId:'',
      zrNickname: '未登录',
      zrTelephone: '',
      zrPassword: '',
      zrLevel:1,
      zrGrowth:0,
      zrBeans:0,
    },
    zrSecret:{
      secretId:'',
      secretKey:'',
      securityToken:''
    },
    loginStatus:false
  },
  mutations: {
    //同步修改用户信息
    syncUpdateUser(state,user){
      this.state.zrUser = user
      this.state.loginStatus = true
      console.log( this.state.zrUser)
    },
    //更新在线状态
    syncUpdateLoginStatus(state,status){
      this.state.loginStatus = status

    },
    syncUpdateSecret(secret){
      this.state.zrSecret = secret
      console.log( this.state.zrSecret)
    }
  },
  actions: {
    //异步修改用户信息
    asyncUpdateUser(context,payload){
      //todo

    }
  },
  modules: {

  }
})
